<!--
 * Description: FD 所属专案组件
 * Company: 联宝（合肥）电子科技有限公司
 * Author: Qiuxue.Wu
 * Date: 2020/06/10 16:47
-->

<template>
  <div style="margin-top: 10px">
    <div v-if="formData" style="padding-left: 20px">
      <!--数据表单-->
      <el-form label-position="left" label-width="140px" :model="formData" size="mini">
        <el-row>
          <el-col :span="6">
            <!--专案编号-->
            <el-form-item :label="$t('ProjectView.projectId')">
              <span>{{ formData.projectId }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--专案名称-->
            <el-form-item :label="$t('ProjectView.projectName')">
              <span>{{ formData.projectName }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--专案描述-->
            <el-form-item :label="$t('ProjectView.projectDesc')">
              <span>{{ formData.projectDesc }}</span>
            </el-form-item>
          </el-col>
          <!--参照专案编号-->
          <el-col :span="6">
            <el-form-item :label="$t('FdData.baseProjectId')">
              <span>{{ inputData.baseProjectId }}</span>
            </el-form-item>
          </el-col>

          <!--参考配置-->
          <el-col :span="6">
            <el-form-item :label="$t('FdData.baseConfig')">
              <span>{{ inputData.baseConfig }}</span>
            </el-form-item>
          </el-col>

          <!--参考模块-->
          <el-col :span="6">
            <el-form-item :label="$t('FdData.baseModel')">
              <span>{{ inputData.baseModel }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--IDP的PM，域名-->
            <el-form-item :label="$t('ProjectView.pm')">
              <span>{{ formData.pm }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--系列-->
            <el-form-item :label="$t('ProjectView.series')">
              <span>{{ formData.series }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--BU类型 LNB/TNB/Server-->
            <el-form-item :label="$t('ProjectView.bu')">
              <span>{{ formData.bu }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--专案PBM负责人-->
            <el-form-item :label="$t('ProjectView.pbmOwner')">
              <span>
                {{ $store.getters['user/getUserNameById'](formData.pbmOwner) || $t('result.none') }}
              </span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--专案ME负责人-->
            <el-form-item :label="$t('ProjectView.meOwner')">
              <span>
                {{ $store.getters['user/getUserNameById'](formData.meOwner) || $t('result.none') }}
              </span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--专案EE负责人-->
            <el-form-item :label="$t('ProjectView.eeOwner')">
              <span>
                {{ $store.getters['user/getUserNameById'](formData.eeOwner) || $t('result.none') }}
              </span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--专案PKG负责人-->
            <el-form-item :label="$t('ProjectView.pkgOwner')">
              <span>
                {{ $store.getters['user/getUserNameById'](formData.pkgOwner) || $t('result.none') }}
              </span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--是否已分配-->
            <el-form-item :label="$t('ProjectView.isAssigned')">
              <span>{{ $store.getters['dict/dictValue'](formData.isAssigned) }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--创建人-->
            <el-form-item :label="$t('ProjectView.createUser')">
              <span>{{ $store.getters['user/getUserNameById'](formData.createUser) }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--创建时间-->
            <el-form-item :label="$t('ProjectView.createTime')">
              <span>{{ formData.createTime }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--修改人-->
            <el-form-item :label="$t('ProjectView.modifyUser')">
              <span>{{ $store.getters['user/getUserNameById'](formData.modifyUser) }}</span>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <!--修改时间-->
            <el-form-item :label="$t('ProjectView.modifyTime')">
              <span>{{ formData.modifyTime }}</span>
            </el-form-item>
          </el-col>

          <!-- 查看更多 -->
          <el-col :span="24">
            <BaseViewMore :visible.sync="isViewMore" />
          </el-col>

          <div v-if="isViewMore">
            <!--biz类型-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.bizType')">
                <span>{{ formData.bizType }}</span>
              </el-form-item>
            </el-col>

            <!--customerName-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.customerName')">
                <span>{{ formData.customerName }}</span>
              </el-form-item>
            </el-col>

            <!--项目详细设计开始时间-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.dds')">
                <span>{{ formData.dds }}</span>
              </el-form-item>
            </el-col>

            <!--财务编码-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.financeCode')">
                <span>{{ formData.financeCode }}</span>
              </el-form-item>
            </el-col>

            <!--代-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.generation')">
                <span>{{ formData.generation }}</span>
              </el-form-item>
            </el-col>

            <!--model类型-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.modelType')">
                <span>{{ formData.modelType }}</span>
              </el-form-item>
            </el-col>

            <!--成本中心-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.profitCenter')">
                <span>{{ formData.profitCenter }}</span>
              </el-form-item>
            </el-col>

            <!--program-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.program')">
                <span>{{ formData.program }}</span>
              </el-form-item>
            </el-col>

            <!--项目编码-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.projectNumber')">
                <span>{{ formData.projectNumber }}</span>
              </el-form-item>
            </el-col>

            <!--项目类型-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.projectType')">
                <span>{{ formData.projectType }}</span>
              </el-form-item>
            </el-col>

            <!--备注-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.remark')">
                <span>{{ formData.remark }}</span>
              </el-form-item>
            </el-col>

            <!--项目推向市场时间-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.ss')">
                <span>{{ formData.ss }}</span>
              </el-form-item>
            </el-col>

            <!--状态-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.state')">
                <span>{{ formData.state }}</span>
              </el-form-item>
            </el-col>

            <!--tdmsName-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.tdmsName')">
                <span>{{ formData.tdmsName }}</span>
              </el-form-item>
            </el-col>

            <!--teamLocation-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.teamLocation')">
                <span>{{ formData.teamLocation }}</span>
              </el-form-item>
            </el-col>

            <!--系统版本-->
            <el-col :span="6">
              <el-form-item :label="$t('ProjectView.version')">
                <span>{{ formData.version }}</span>
              </el-form-item>
            </el-col>
          </div>
        </el-row>
      </el-form>
    </div>
    <div v-else>
      {{ '暂无数据' }}
    </div>
  </div>
</template>

<script>
import { projectQueryByTempModelId } from '@/api/quote/project'
export default {
  name: 'FdProject',
  props: {
    inputData: {
      default: () => null,
      type: Object
    }
  },
  data() {
    return {
      isViewMore: false,
      formData: null
    }
  },
  computed: {},
  watch: {},

  mounted() {
    this.pageDataInit()
  },
  methods: {
    async pageDataInit() {
      try {
        if (!this.inputData.tempModel) {
          return
        }
        const res = await projectQueryByTempModelId({ tempModelId: this.inputData.tempModel })
        this.formData = res.data
      } catch (error) {
        console.log(error)
      }
    }
  }
}
</script>

<style scoped>
.el-form-item__content span {
  margin-left: 5px;
  color: blue;
}
</style>
